package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.SystemDictionaryItem;
import cn.wolfcode.crm.mapper.SystemDictionaryItemMapper;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.ISystemDictionaryItemService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SystemDictionaryItemServiceImpl implements ISystemDictionaryItemService {

	@Autowired
	private SystemDictionaryItemMapper dictionaryItemMapper;


	public void insert(SystemDictionaryItem entity) {
		dictionaryItemMapper.insert(entity);
	}

	public SystemDictionaryItem selectByPrimaryKey(Long id) {
		return dictionaryItemMapper.selectByPrimaryKey(id);
	}

	public List<SystemDictionaryItem> selectAll() {
		return dictionaryItemMapper.selectAll();
	}

	public void updateByPrimaryKey(SystemDictionaryItem entity) {
		dictionaryItemMapper.updateByPrimaryKey(entity);
	}

	public PageInfo query(QueryObject qo) {
		PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize());
		List<SystemDictionaryItem> data = dictionaryItemMapper.queryForList(qo);
		return new PageInfo(data);
	}

	public List<SystemDictionaryItem> listItemBySn(String sn) {
		return dictionaryItemMapper.selectItemBySn(sn);
	}


}
